package com.itheima.config;

import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
public class PasswordConfig {

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }


    public static void main(String[] args) {
        BCryptPasswordEncoder encoder  = new BCryptPasswordEncoder();
        //加密
//        String password = encoder.encode("123456");
//        System.out.println(password);
        //解密
//        boolean matches = encoder.matches("123456","$2a$10$kalRU9p9M9lBGkTbC13LTenO.ulxWKbAGjxxHnSVcWZEtr/PquRRa");
//        System.out.println(matches);
    }
}



